package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.FailPlanList;
import cn.wolfcode.crm.mapper.FailPlanListMapper;
import cn.wolfcode.crm.query.FailPlanListQueryObject;
import cn.wolfcode.crm.service.IFailPlanListService;
import cn.wolfcode.crm.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class FailPlanListServiceImpl implements IFailPlanListService {

    @Autowired
    private FailPlanListMapper mapper;

    public int deleteByPrimaryKey(Long id) {
        return mapper.deleteByPrimaryKey(id);
    }

    public int insert(FailPlanList record) {
        return mapper.insert(record);
    }

    public FailPlanList selectByPrimaryKey(Long id) {
        return mapper.selectByPrimaryKey(id);
    }

    public List<FailPlanList> selectAll() {
        return selectAll();
    }

    public int updateByPrimaryKey(FailPlanList record) {
        return mapper.updateByPrimaryKey(record);
    }

    public PageResult list(FailPlanListQueryObject qo) {
        int count = mapper.query4Count(qo);
        if (count > 0) {
            return new PageResult(count, mapper.query4List(qo));
        }
        return new PageResult(count, Collections.EMPTY_LIST);
    }
}
